import validate from "uuid-validate";

export const isString = (parameter: any): boolean => {
  return typeof parameter === "string";
};

export const isNotEmptyString = (parameter: any): boolean => {
  return isString(parameter) && parameter !== "";
};

export const inLength = (maxLength: number, minLength = 1) => {
  return (parameter: any): boolean => {
    return (
      isString(parameter) &&
      parameter.length <= maxLength &&
      parameter.length >= minLength
    );
  };
};

export const isUuid = (parameter: any): boolean => {
  return isString(parameter) && validate(parameter);
};
